#ifndef TCPMODULE_H
#define TCPMODULE_H

#include "Module.h"  // 假设这是您自定义的模块基类头文件
#include "Channel.h" // 假设这是处理epoll事件的Channel类头文件
#include <iostream>
#include <sys/socket.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <unistd.h>
#include <functional>
class TcpClientModule:public Module
{
    public:
      
        TcpClientModule(int fd){ m_fd=fd;}
        void read_message() override;
        int close_client(void* arg);
    private:
    public:
    callback m_back;
};
class TcpModule : public Module
{
public:
    TcpModule(std::string addr,int port = 8080);
    ~TcpModule();
    void read_message() override;
    void init();
    void set_conn_read_back(callback cb){client_cb=cb;}
private:
    int m_port;
    TcpClientModule* client;
    callback client_cb;
};

#endif // TCPMODULE_H